<?php if (!defined('THINK_PATH')) exit(); /*a:1:{s:64:"F:\yxl\tp5.com\public/../application/index\view\nav\add_nav.html";i:1558751313;}*/ ?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>添加导航</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css">
</head>
<body>
<div >
    <form class="layui-form" action="" lay-filter="example">
        <div class="layui-form-item">
            <label class="layui-form-label">菜单名</label>
            <div class="layui-input-inline">
                <input type="text" name="name" lay-verify="required" autocomplete="off"
                       placeholder="请输入名称..." class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">链接地址</label>
            <div class="layui-input-inline">
                <input type="text" name="filepath" lay-verify="required" autocomplete="off"
                       placeholder="请输入链接..." class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">等级</label>
            <div class="layui-input-inline">
                <input type="text" name="level" lay-verify="required" autocomplete="off"
                       placeholder="请输入等级..." class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">上级菜单</label>
            <div class="layui-input-inline">
                <select name="pid">
                    <option value=""></option>
                    <?php if(is_array($data) || $data instanceof \think\Collection || $data instanceof \think\Paginator): $i = 0; $__LIST__ = $data;if( count($__LIST__)==0 ) : echo "" ;else: foreach($__LIST__ as $key=>$vo): $mod = ($i % 2 );++$i;?>
                    <option value="<?php echo $vo['id']; ?>"><?php echo $vo['s']; ?><?php echo $vo['name']; ?></option>
                    <?php endforeach; endif; else: echo "" ;endif; ?>
                </select>
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">是否显示</label>
            <div class="layui-input-inline">
                <input type="checkbox" name="show" lay-skin="switch">
            </div>
        </div>


        <div class="layui-form-item">
            <label class="layui-form-label">排序号</label>
            <div class="layui-input-inline">
                <input type="text" name="sort" lay-verify="title" size="20px" autocomplete="off"
                       placeholder="请输入序号..." class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit="" lay-filter="formDemo">立即提交</button>
            </div>
        </div>
        <li class="layui-nav-item"><a href="/demo/index/index">进入导航</a></li>
    </form>
</div>
</body>
<script src="/static/layui/layui.js"></script>
<script>
    //var upload = layui.upload;
    //指定允许上传的文件类型
    layui.use(['jquery','form'], function(){
        var jquery = layui.jquery;
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            jquery.post("/index/nav/addNav",data.field,function(result)
            {
                if(result=='ok'){
                    layer.msg('添加成功!');
                    //window.parent.location.reload();
                }
            });
            return false;
        });

    });
</script>
</html>